<h1>Contact</h1>
<div class="alert alert-info">
  <%= render 'directions' %>
</div>

<% if user_signed_in? %>
  <% nm = current_user.name %>
  <% em = current_user.email %>
<% else %>
  <% nm = '' %>
  <% em = '' %>
<% end %>

<h2>Contact Form</h2>
<%= form_for @contact_form, url: sufia.contact_form_index_path,
                            html: { class: 'form-horizontal' } do |f| %>
  <%= f.text_field :contact_method, class: 'hide' %>
  <div class="form-group">
    <%= f.label :category, 'Issue Type', class: "col-sm-2 control-label" %>
    <% issue_types = Sufia::ContactForm::ISSUE_TYPES.dup %>
    <% issue_types.unshift(['Select an Issue Type', nil]) %>
    <div class="col-sm-10">
      <%= f.select 'category', options_for_select(issue_types), {}, {class: 'form-control', required: true } %>
    </div>
  </div>

  <div class="form-group">
    <%= f.label :name, 'Your Name', class: "col-sm-2 control-label" %>
    <div class="col-sm-10"><%= f.text_field :name, value: nm, class: 'form-control', required: true %></div>
  </div>

  <div class="form-group">
    <%= f.label :email, 'Your Email', class: "col-sm-2 control-label" %>
    <div class="col-sm-10"><%= f.text_field :email, value: em, class: 'form-control', required: true %></div>
  </div>

  <div class="form-group">
    <%= f.label :subject, 'Subject', class: "col-sm-2 control-label" %>
    <div class="col-sm-10"><%= f.text_field :subject, class: 'form-control', required: true %></div>
  </div>

  <div class="form-group">
    <%= f.label :message, 'Message', class: "col-sm-2 control-label" %>
    <div class="col-sm-10"><%= f.text_area :message, rows: 4, class: 'form-control', required: true %></div>
  </div>

  <%= f.submit value: "Send", class: "btn btn-primary" %>
<% end %>
